/**
 * Copyright &copy; 2012-2014 <a href="https://github.com/thinkgem/jeesite">JeeSite</a> All rights reserved.
 */
package com.sf.dlb.config;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Scope;
import org.springframework.stereotype.Component;


/**
 * 全局配置类
 *
 * Created by jing.tan on 2018/12/10.
 */
@Component("global")
@Scope("singleton")
public class Global {
	/** 基本属性 **/
	@Value("${project.index.path}")
	public String project_index_path;
	@Value(value = "${sms.service.url}")
	public String sms_service_url;
	@Value(value = "${sms.validation.code.time}")
	public String sms_validation_code_time;
	@Value(value = "${token.valid.time}")
	public String token_valid_time;
	@Value(value = "${token.request.header.key}")
	public String token_request_header_key;
	@Value("${token.request.header.value.prefix}")
	public String token_request_header_value_prefix;
	@Value(value = "${file.image.absolute.path}")
	public String file_image_absolute_path;
	@Value(value = "${file.image.relative.path}")
	public String file_image_relative_path;
	@Value("${file.public.ip}")
	public String file_public_ip;

	/** 钱包相关 **/
	@Value("${wallet.dlb.unlock.time.day}")
	public int wallet_dlb_unlock_time_day;
	@Value("${wallet.extract.charge}")
	public Double wallet_extract_charge;// 手续费
	@Value("${wallet.extract.least.number}")
	public Double wallet_extract_least_number;// 最小提现额度；手续费+1
	@Value("${wallet.extract.timeout}")
	public int wallet_extract_timeout; // 提现超时时间；
	@Value("${wallet.read.getdlb.yield}")
	public double wallet_read_getdlb_yield;

	/** 用户相关 **/
	@Value("${user.the.invitation.user.get.dlb}")
	public Double user_the_invitation_user_get_dlb;
	@Value("${user.be.invitation.user.get.dlb}")
	public Double user_be_invitation_user_get_dlb;
	@Value(value = "${user.qrcode.width}")
	public String user_qrcode_width;
	@Value(value = "${user.qrcode.height}")
	public String user_qrcode_height;
	@Value("${user.login.error.number}")
	public int user_login_error_number;
	@Value("${user.every.reduce.number}")
	public int user_every_reduce_number;
	@Value("${user.visitor.token.prefix}")
	public String user_visitor_token_prefix;
	@Value("${user.share.url}")
	public String user_share_url;

	/** 新闻相关 **/
	@Value("${new.sub.default.class}")
	public String new_sub_default_class;
	@Value("${new.read.slide.number.factor}")
	public int new_read_slide_number_factor;
	@Value("${new.details.page.link}")
	public String new_details_page_link;

	/** 视频相关 **/
	@Value("${video.play.getdlb.yield}")
	public double video_play_getdlb_yield;
	@Value("${video.play.getdlb.number}")
	public int video_play_getdlb_number;

	/** java调用py钱包 **/
	@Value("${py.http.api.extract}")
	public String py_http_api_extract;
	@Value("${py.http.api.address.validation}")
	public String py_http_api_address_validation;
	@Value("${py.http.api.extract.recrd}")
	public String py_http_api_extract_recrd;
	@Value("${py.http.api.topup.recrd}")
	public String py_http_api_topup_recrd;
	@Value("${py.http.api.generate.address}")
	public String py_http_api_generate_address;
	@Value("${py.http.api.generate.address.count}")
	public String py_http_api_generate_address_count;
	@Value("${py.address.remain.number.threshold}")
	public int py_address_remain_number_threshold;
	@Value("${py.http.api.time.out}")
	public int py_http_api_time_out;
	@Value("${py.http.api.exchange}")
	public String py_http_api_exchange;

	public String getUser_image_absolute_path(String userId) {
		StringBuffer absolutePath=new StringBuffer();
		absolutePath.append(file_image_absolute_path)
				.append("/").append(userId);
		return absolutePath.toString();
	}

	public String getUser_image_relative_path(String userId) {
		StringBuffer relativePath=new StringBuffer();
		relativePath.append(file_image_relative_path)
				.append("/").append(userId);
		return relativePath.toString();

	}
}
